Skip to main content

Automation Rules Management

Overview

Automation Rules provide the logic for automatically processing uploaded media files by matching file characteristics (Type and Origin) to specific LangFlow agents. Each rule can trigger multiple agents for comprehensive content processing.

Rule Components

Core Fields

  • ID: Unique numeric identifier (auto-generated)
  • Name: Descriptive identifier for the rule
  • Type: Media type classification (e.g., "audio", "video", "document")
  • Origin: Source identifier for uploaded files
  • Agents: Array of LangFlow agent IDs to execute
  • Is Active: Boolean flag for rule enablement
  • Client ID: Client ownership and isolation
  • Last Update: Timestamp of most recent modification
  • Created At: Rule creation timestamp

Rule Schema

interface Automation {
id: number;
name: string; // "Meeting Analysis Rule"
type: string; // "audio"
origin: string; // "meeting_uploads"
agents: string[]; // ["sentiment_agent", "summary_agent"]
last_update: Date;
is_active: boolean; // true
client_id: string; // "client_123"
}

CRUD Operations

Creating Rules

Step 1: Basic Information

  1. Navigate to Automation Rules Management
  2. Click "Create New Rule"
  3. Enter descriptive name
  4. Select client scope

Step 2: Matching Criteria

  • Type Configuration: Define media type patterns
    • Exact match: "audio"
    • Wildcard match: "audio/*"
    • Multiple types: ["audio", "video"]
  • Origin Configuration: Specify source patterns
    • Exact match: "meeting_uploads"
    • Pattern match: "*/meetings/*"
    • Client-specific: "client_123/uploads"

Step 3: Agent Assignment

{
"agents": [
"transcription_agent",
"sentiment_analysis",
"meeting_summarizer",
"action_items_extractor"
]
}

Step 4: Activation

  • Enable Rule: Set is_active: true
  • Test Configuration: Validate agent connectivity
  • Save Rule: Persist to database

Reading Rules

List All Rules

GET /api/automations?page=1&limit=10

Response:

[
{
"id": 1,
"name": "Meeting Analysis Rule",
"type": "audio",
"origin": "meeting_uploads",
"agents": ["sentiment_agent", "summary_agent"],
"is_active": true,
"client_id": "client_123",
"last_update": "2024-01-15T10:30:00Z",
"created_at": "2024-01-01T09:00:00Z"
}
]

Search Rules by Type and Origin

GET /api/automations/search?origin=meeting_uploads&type=audio

Detailed Rule View

Individual rule details include:

  • Complete configuration
  • Agent execution history
  • Performance statistics
  • Recent processing results

Updating Rules

Editable Fields

All fields except id and created_at can be modified:

  • Name and Description: Update rule identification
  • Type and Origin: Modify matching patterns
  • Agent List: Add, remove, or reorder agents
  • Active Status: Enable/disable rule
  • Client Assignment: Transfer rule ownership

Update Process

PATCH /api/automations/:id
Content-Type: application/json

{
"name": "Updated Meeting Analysis",
"agents": ["new_agent_id", "existing_agent_id"],
"is_active": false
}

Response:

{
"success": "Automation updated successfully"
}

Deleting Rules

Safety Measures

  • Impact Analysis: Shows affected conversations and processing history
  • Confirmation Dialog: Requires explicit confirmation
  • Soft Delete Option: Disable instead of permanent deletion
  • Backup Recommendation: Export rule configuration before deletion

Deletion Process

DELETE /api/automations/:id

Response:

{
"message": "Automation deleted successfully"
}

Rule Matching Logic

Type Matching

Rules match files based on:

  • MIME Type Detection: Automatic content type identification
  • File Extension Analysis: Extension-based classification
  • Content Inspection: Deep content analysis for classification
  • Custom Type Headers: API-provided type information

Origin Matching

Origin identification uses:

  • Upload Source Tracking: API endpoint or interface identification
  • User-Defined Tags: Custom origin labels
  • Storage Path Analysis: Folder structure-based origin detection
  • Metadata Extraction: Origin from file metadata

Client Isolation

  • Rule Ownership: Each rule belongs to specific client
  • Matching Scope: Rules only match files from same client
  • Access Control: Clients can only modify their own rules
  • Data Separation: Complete isolation between client data

Priority Resolution

When multiple rules match the same file:

  1. Most Specific Match: Exact type+origin combinations win
  2. Rule Order: Lower ID numbers have higher priority
  3. Active Rules Only: Disabled rules are excluded
  4. Client Scope: Only client-owned rules considered

Agent Execution

Sequential vs Parallel Processing

  • Sequential: Agents execute one after another
  • Parallel: All agents execute simultaneously (default)
  • Hybrid: Mix of sequential and parallel execution

Agent Configuration

{
"agents": [
{
"id": "transcription_agent",
"priority": 1,
"timeout": 300,
"retry_count": 3
},
{
"id": "analysis_agent",
"priority": 2,
"depends_on": ["transcription_agent"]
}
]
}

Input Data Format

Each agent receives standardized input:

{
"conversation": {
"id": "conv_uuid",
"transcript": "Full transcription text",
"metadata": {
"filename": "meeting.mp3",
"duration": "00:45:30",
"language": "en-US"
}
},
"automation": {
"rule_id": 1,
"type": "audio",
"origin": "meeting_uploads"
}
}

Advanced Configuration

Conditional Logic

  • IF/THEN Rules: Complex condition-based execution
  • Multiple Conditions: Boolean operators (AND, OR, NOT)
  • Dynamic Parameters: Runtime parameter calculation
  • Context-Aware Processing: Decisions based on content analysis

Error Handling

  • Retry Policies: Automatic retry with exponential backoff
  • Fallback Agents: Alternative agents for failed executions
  • Partial Success: Continue processing with available results
  • Error Escalation: Notification and manual intervention triggers

Performance Optimization

  • Agent Caching: Reuse previous results when applicable
  • Resource Limits: Memory and CPU constraints per agent
  • Timeout Management: Configurable execution time limits
  • Load Balancing: Distribute processing across multiple workers

Monitoring and Analytics

Rule Performance Metrics

  • Execution Count: Number of times rule has triggered
  • Success Rate: Percentage of successful agent executions
  • Average Processing Time: Mean execution duration
  • Error Frequency: Common failure patterns
  • Resource Usage: CPU, memory, and storage consumption

Agent Analytics

{
"agent_performance": {
"transcription_agent": {
"executions": 1250,
"success_rate": 98.4,
"avg_duration": 45.2,
"error_types": {
"timeout": 12,
"memory_limit": 3,
"api_error": 5
}
}
}
}

Rule Optimization Recommendations

  • Underperforming Agents: Identify agents with high failure rates
  • Resource Bottlenecks: Detect agents causing delays
  • Usage Patterns: Optimize rules based on file characteristics
  • Cost Analysis: Balance processing cost vs. result quality

Best Practices

Rule Design

  • Descriptive Names: Use clear, searchable rule names
  • Specific Matching: Avoid overly broad type/origin patterns
  • Agent Ordering: Place critical agents first in the list
  • Regular Review: Periodically evaluate rule effectiveness

Agent Selection

  • Complementary Agents: Choose agents that provide different insights
  • Performance Balance: Mix fast and comprehensive agents
  • Reliability First: Prioritize stable, well-tested agents
  • Cost Consideration: Balance processing cost with result value

Maintenance

  • Regular Updates: Keep agent configurations current
  • Performance Monitoring: Track rule execution metrics
  • Error Analysis: Investigate and resolve common failures
  • Capacity Planning: Scale resources based on usage patterns

Security

  • Access Control: Restrict rule modification to authorized users
  • Agent Validation: Verify agent authenticity and security
  • Data Privacy: Ensure agents comply with data protection requirements
  • Audit Logging: Maintain complete record of rule changes

Troubleshooting

Common Issues

Rules Not Triggering

Symptoms: Files processed without automation Solutions:

  1. Verify rule is active (is_active: true)
  2. Check type and origin matching patterns
  3. Confirm file belongs to correct client
  4. Review rule priority conflicts

Agent Execution Failures

Symptoms: Partial or failed processing results Solutions:

  1. Test individual agents independently
  2. Check agent connectivity and permissions
  3. Verify input data format compatibility
  4. Review agent resource requirements

Performance Problems

Symptoms: Slow or hanging rule execution Solutions:

  1. Optimize agent selection and ordering
  2. Implement timeout limits
  3. Monitor resource usage patterns
  4. Consider parallel vs sequential execution

Diagnostic Tools

  • Rule Testing: Simulate rule execution with sample files
  • Agent Validation: Test individual agent connectivity
  • Performance Profiling: Analyze execution bottlenecks
  • Error Log Analysis: Review detailed failure information